#include "EpollServer.hpp"


std::string request(std::string str)
{
    // 执行回调
    std::cout << str << std::endl;
    std::unordered_map<std::string, std::string> map;
    map["hello"] = "你好";
    map["yes"] = "是的"; 
    map["ok"] = "好的"; 
    map["word"] = "世界";

    std::string request;
    for (auto c : str)
    {
        if ((c <= 'z' && c >= 'a') || (c <= 'Z' && c >= 'A'))
            request += c;
    }
    
    auto res = map.find(request);
    std::string response;
    if (res == map.end()) response = "抱歉，我正在学习中";
    else response = res->second;
    return response + "\n";
}

int main()
{
    std::unique_ptr<EpollServer> server(new EpollServer(request));
    server->Start();

    return 0;
}